package birdsVSZombiesComponents;

import org.jbox2d.common.Vec2;
import fisica.FCircle;

public class BaseCircle extends AbstractBox2DShape {
	
	public FCircle baseCircle;
	
	public float baseRadius;
	
	
	public BaseCircle(int _master) {
		super();
		this.baseRadius = 20;
		this.master = _master;
		makeBaseBody(baseRadius, new Vec2(baseX, baseY));
	}

	public BaseCircle(int _master, float baseDensity) {
		super(baseDensity);
		this.baseRadius = 20;
		this.master = _master;
		makeBaseBody(baseRadius, new Vec2(baseX, baseY));
	}

	public BaseCircle(float baseX, float baseY, float baseRadius, int _master) {
		super(baseX, baseY);
		this.baseRadius = baseRadius;
		this.master = _master;
		makeBaseBody(baseRadius, new Vec2(baseX, baseY));
		// TODO Auto-generated constructor stub
	}

	public BaseCircle(float baseX, float baseY, float baseRadius, int _master,
			float baseDensity, float baseFriction, float baseRestitution) {
		super(baseX, baseY, baseDensity, baseFriction, baseRestitution);
		this.baseRadius = baseRadius;
		this.master = _master;
		makeBaseBody(baseRadius, new Vec2(baseX, baseY));
		// TODO Auto-generated constructor stub
	}

	public BaseCircle(float baseX, float baseY, float baseRadius, int _master, int baseColor,
			int baseStrokeColor, int baseStrokeWeight, float baseDensity,
			float baseFriction, float baseRestitution) {
		super(baseX, baseY, baseColor, baseStrokeColor,
				baseStrokeWeight, baseDensity, baseFriction, baseRestitution);
		
		this.baseRadius = baseRadius;
		this.master = _master;
		makeBaseBody(baseRadius, new Vec2(baseX, baseY));
		// TODO Auto-generated constructor stub
	}
	
	public void makeBaseBody(float _r, Vec2 center){
		baseCircle = new FCircle(baseRadius*2);
		baseCircle.setDensity(baseDensity);
		baseCircle.setFriction(baseFriction);
		baseCircle.setRestitution(baseRestitution);
		baseCircle.setPosition(center.x, center.y);
		
		baseCircle.setFillColor(baseColor);
		baseCircle.setStrokeWeight(baseStrokeWeight);
		baseCircle.setStrokeColor(baseStrokeColor);
		
//		baseCircle.setGrabbable(false);
		
		baseCircle.addToWorld(world, master);
		
	}
	
	//	Replaced by the display function in Fisica
	public void display(){
//		Vec2 pos = box2d.getScreenPos(baseBody);
//		float a = baseBody.getAngle();
//		
//		parent.ellipseMode(PConstants.CENTER);
//		parent.pushMatrix();
//		parent.translate(pos.x, pos.y);
//		parent.rotate(PConstants.PI - a);
//		parent.fill(baseColor);
//		parent.stroke(baseStrokeColor);
//		parent.strokeWeight(baseStrokeWeight);
//		parent.ellipse(0, 0, baseRadius*2, baseRadius*2);
//		parent.line(0, 0, baseRadius, 0);
//		parent.popMatrix();
	}
	
	public float getPosX(){
		return baseCircle.getX();
	}
	
	public float getPosY(){
		return baseCircle.getY();
	}
	
	public float getAngle(){
		return baseCircle.getRotation();
	}

	
}
